<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简易计算器</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <div class="container">
        <h1>简易计算器</h1>
        
        <div class="calculator">
            <!-- 显示区域 -->
            <div class="display-container">
                <div class="display-history">{{ displayHistory }}</div>
                <div class="display" id="display">0</div>
            </div>
            
            <!-- 按钮区域 -->
            <div class="buttons-grid">
                <!-- 第一行 -->
                <button class="button function" onclick="clearAll()">AC</button>
                <button class="button function" onclick="clearEntry()">CE</button>
                <button class="button function" onclick="toggleSign()">±</button>
                <button class="button operator" onclick="setOperator('/')">÷</button>
                
                <!-- 第二行 -->
                <button class="button number" onclick="appendNumber('7')">7</button>
                <button class="button number" onclick="appendNumber('8')">8</button>
                <button class="button number" onclick="appendNumber('9')">9</button>
                <button class="button operator" onclick="setOperator('*')">×</button>
                
                <!-- 第三行 -->
                <button class="button number" onclick="appendNumber('4')">4</button>
                <button class="button number" onclick="appendNumber('5')">5</button>
                <button class="button number" onclick="appendNumber('6')">6</button>
                <button class="button operator" onclick="setOperator('-')">−</button>
                
                <!-- 第四行 -->
                <button class="button number" onclick="appendNumber('1')">1</button>
                <button class="button number" onclick="appendNumber('2')">2</button>
                <button class="button number" onclick="appendNumber('3')">3</button>
                <button class="button operator" onclick="setOperator('+')">+</button>
                
                <!-- 第五行 -->
                <button class="button number zero" onclick="appendNumber('0')">0</button>
                <button class="button number" onclick="appendDecimal()">.</button>
                <button class="button equals" onclick="calculate()">=</button>
            </div>
        </div>
        
        <!-- 历史记录区域 -->
        <div class="history-section">
            <div class="history-header">
                <h3>计算历史</h3>
                <button class="clear-history-btn" onclick="clearHistory()">清除历史</button>
            </div>
            <div class="history-list" id="history-list">
                <!-- 历史记录将通过JavaScript动态添加 -->
                <div class="no-history">暂无历史记录</div>
            </div>
        </div>
    </div>
    
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
</body>
</html>